package com.atlin.project.config;

import com.alipay.api.AlipayConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author atlin
 * @description 支付宝配置
 * @createDate 2024/11/25 15:14
 */
@Configuration
public class AliPayConfig {

    /**
     * 应用ID
     */
    private static final String APPID = "9021000132661529";

    /**
     * 私钥 --- 支付宝 沙箱
     */
    private static final String PRIVATEKEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCIKbZdqY2F6Zhpi60LKv/uFsUkkVf8ox/gDkKs9m8/8gmg/BoUfpOMghs6b00AU1moinZI85TImkPmtNn4cv/dQue9XW1wZMFwIbhUNlcNNl+qI7vy79GATwlrinTMGlRGZdlWrxnVqpOB1fX5veSPwyRvPLCqtKgb+98/M3SrOCHi6AgReNa5Njdt7VbGu0B/gyoXXpRRbOKEzC9Io8bnWIPNgANqucy7tp5uXFTe2iQX0oLo/gJPWYbZgke5hB3jYajbjK89Qw9hAuu5huPNPjIVP7LQjsqDRxfq/7KC7Lo9vc7q9Mf/BaUt0xh6et0wpTQy6NlND/4z3v35/tSjAgMBAAECggEAPad9jv2WOnuiarA3Q6ZNypX+4Gb7i0alyUNLx5uylibXW1Cr0nnZ/7Zt89Cv8iTLpThFBRVeWlMXyeA8DnasCpkf66vhQRIuUMLD/0W3tyDWwmh50y/qEgo3vr0r07tcS6AUgF66+PfK4PBr95CXbM00szWs3S7+K+WpmamH+3q/HVY3EMSKCNGqoO6azh2965P/IfhTUUsOyPBUjuR06769UekfW2X5WlT3O2sB3Ge5IJpJH4m3YfhGcg498cEL0jsmIK7YzXEy1kX97tGA43Iyzol6iQPK7poVzb6wtK31jK67wDoV4InzphT4pfwp4tUY9I+0s3/8PRllNul+aQKBgQDAarcorNkgc5PUgCRN6HQclMf2cD+EXd6Oaf4/i1B3x6FJjsGkJ5ZJEjoL5sHX9PAeV++hYoG0t5bKf/DNZuSccYzf0sZoHi3HHOEPNr6SQba6PoEEEXrup9/zJJX5RtE/IQSVQY/XM1DEroSi+zOJabO1b854TfXPEZe0KIwjVQKBgQC1KELHQ5qbTTPdYYdnf3kvGmUeFgydoeimfZa87QOiNyPxF8o0rQnRNtnf+BYMC75OULfGdvEEABiWAnLylr+4xA/gLnB2g7byKHe2odxuG9iTNI8JRYyVI8x82PBmsML+cxV59R8mI28RPQWBKTX0OhFoUXKwZ4GjiwcyfRkIFwKBgAKZ7rv4Cj9sEJWQ3ezHtbolMMbeIZ2yfy3BtRQ61+2mn0GVUnzbpCZ8vpgmmHxI7W4bljvCTyqYSMuYCzNbrr+GsXbdLJ1/uvK0Kz6/aLgld0jxS2E4s0bCsj5hQj3KfU2zLpKt/jnUkcT27wgdCUdUTH+pcUsjEq2n+TsQSUS5AoGBAKsLu5mXfEg8accSSh3v30UZP/ZbTUgc0qU4mXYCt9aXB6mhE7wO0eEnUCpHfNGc2O/rCMosDb8ANDaXU1839QgInxDF6EwOa1NT4EyhoZaZVjEPhCp175n1tiL/VmUvar2Dffir9+Azvq/hFOxyM85IcZ00ofxrjp0TLRV/xn27AoGAX+Lzl0fskRG/vozEELCleLSDshtuyACTIWI3o/dRe8hWQlMb4TsNDRKDK20xRXnAFxD2enWYcAVym95xGu9VHAr/yFpSbQQFvqYHE1inWlpmPH4mhLlBjeJWSaTnGYExc8VeUeJgAQ0TgCV8amljzSy3/YjS6TAX+wNY4h02y0A=";

    /**
     * 公钥 --- 支付宝 沙箱
     */
    public static final String ALIPAYPUBLICKEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqD7bhk2xehId0NmTo9K0lQ33l7LisCQFf/QoNltCNmd7Aj3YOvnWp1BUHjiERb75Ign/VEs0WjU4i+K+mngWj9mshPIXFyNOVTliKm86KIxCrxbDEtvpmTwSifup7hQd/KW26tUjebwisv6oXMkWE0HDppxE09dxEu9vELdyLqreQmC6TIc6A2hVcTUoMQ6JgGAH2tGKs+8f3MQD0HyDzy24rkO/5HizQUknGNXOW5U0vttz+4G24KqB+/c1TAqEudSg7YJ7cBECzvWMjQ/9w9T9HCwl5622hLxUhCATKqs1kNVcbytY7nzUoK0jzA6DeKjEowCHRwHORoBu32ydGwIDAQAB";


    @Bean
    public AlipayConfig alipayConfig() {
        AlipayConfig alipayConfig = new AlipayConfig();
        alipayConfig.setServerUrl("https://openapi-sandbox.dl.alipaydev.com/gateway.do");
        alipayConfig.setAppId(APPID);
        alipayConfig.setPrivateKey(PRIVATEKEY);
        alipayConfig.setFormat("json");
        alipayConfig.setAlipayPublicKey(ALIPAYPUBLICKEY);
        alipayConfig.setCharset("UTF-8");
        alipayConfig.setSignType("RSA2");

        return alipayConfig;
    }
}
